package com.imooc;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class CalendarTest {
	
	public static void main(String[] args) {
		//创建Calendar对象
		Calendar c = Calendar.getInstance();
		
		//将Calendar对象转换为Date对象
		Date date = c.getTime();
		
		//格式化日期
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		System.out.println("当前时间："+sdf.format(date));
	}
}
